package decisionalalgorithms.guialgorithms.converters;

import decisionalalgorithms.guialgorithms.commands.ResultsCommand;
import decisionalalgorithms.guialgorithms.domain.Results;
import org.springframework.core.convert.converter.Converter;
import org.springframework.stereotype.Component;

@Component
public class ResultsToResultsCommand implements Converter<Results, ResultsCommand> {
    @Override
    public ResultsCommand convert(Results source) {
        if (source == null) {
            return null;
        }
        final ResultsCommand resultsCommand = new ResultsCommand();
        resultsCommand.setId(source.getId());
        resultsCommand.setAlgorithm(source.getAlgorithm());
        resultsCommand.setResult(source.getResult());
        return resultsCommand;
    }
}
